class MyException(Exception):
    def __str__(self):
        return "我是自定义异常"
    pass
try:
    num=int(input("请输入一个数字"))
    if num>10:
        raise MyException()
    pass
except MyException as msg:
    print(msg)